Skip to content

Conversation

@abhinavk96
Copy link
Contributor

@abhinavk96 abhinavk96 commented Jul 31, 2019

Fixes #6276

Short description of what this resolves:

  • Moves the stripe authorization relationship from EventSchema to EventPublicSchema, as normal users need publishable keys.

  • Use proper decorators for GET and POST requests in stripeAuhorizarion API.

Publishable API keys are meant solely to identify your account with Stripe, they aren’t secret. In other words, they can safely be published in places like your Stripe.js JavaScript code, or in an Android or iPhone app. Publishable keys only have the power to create tokens
Reference

  • stripe_auth_code (the other field in stripeAuhorizarion schema) has load_only=true, hence is never serialized in a GET request.

@codecov
Copy link

codecov bot commented Jul 31, 2019

Codecov Report

Merging #6277 into development will decrease coverage by 0.03%.
The diff coverage is 57.14%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #6277      +/-   ##
===============================================
- Coverage        65.57%   65.54%   -0.04%     
===============================================
  Files              286      286              
  Lines            14567    14588      +21     
===============================================
+ Hits              9552     9561       +9     
- Misses            5015     5027      +12
Impacted Files Coverage Δ
app/api/schema/events.py 91.79% <100%> (ø) ⬆️
app/api/schema/stripe_authorization.py 100% <100%> (ø) ⬆️
app/api/stripe_authorization.py 45.94% <36.84%> (-6.6%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce62ff0...ebb8cf0. Read the comment docs.

@iamareebjamal
Copy link
Member

StripeAuthorizationSchema may contain other sensitive keys as well? Or is it just public key

@abhinavk96
Copy link
Contributor Author

abhinavk96 commented Jul 31, 2019 via email

@iamareebjamal
Copy link
Member

Still, it should not be shown to any user. Instead, StripeAuthorizationPublicSchema should be made which only includes public keys


stripe_auth_code = fields.Str(load_only=True, required=True)


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line at end of file

@abhinavk96
Copy link
Contributor Author

@iamareebjamal done.

@abhinavk96 abhinavk96 merged commit 1ef10f5 into fossasia:development Jul 31, 2019
mrsaicharan1 pushed a commit to mrsaicharan1/open-event-server that referenced this pull request Aug 9, 2019
Comment on lines +73 to +74
decorators = (api.has_permission('is_coorganizer', fetch="event_id",
fetch_as="event_id", model=StripeAuthorization),)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fossasia/open-event-frontend#3523 is happening due to this. The endpoint is /v1/stripe-authorizations, there is no event_id in view kwargs and hence it fails everytime it is accessed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CosmicCoder96 Can this be removed or was it added for a specific reason. I can't see how it will work for /v1/stripe-authorizations endpoint. Maybe it is used in some other relations. Please clarify so that we don't break something else when removing this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal It should be removed. Won't affect FE.

@iamareebjamal
Copy link
Member

@kushthedude @codedsun Please handle this ASAP

@codedsun
Copy link
Contributor

@iamareebjamal Do i have to remove the decorators?

@iamareebjamal
Copy link
Member

Yes

@codedsun
Copy link
Contributor

Sending a pr!

@kushthedude
Copy link
Member

kushthedude commented Nov 27, 2019 via email

@codedsun
Copy link
Contributor

@kushthedude- @iamareebjamal has confirmed in the issue #6277 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not being able to pay with Stripe

5 participants